﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.CSharp;
using System.CodeDom.Compiler;
using System.Reflection;
using CSScriptLibrary;
using System.IO;
using PocketEngine.Engine;
namespace PocketEngine.Scripting
{
    
   
    
    public interface pPlugin
    {
        object RunScript(object data);
    }
    

    public class pScript
    {
        /// <summary>
        /// This is the raw asmhelper from the csscript lib, use it wisely, my son. 
        /// </summary>
        public AsmHelper Asm = null;

        public pScript(string path)
        {
            Asm = new AsmHelper(CSScript.Load(path,null,true));
        }
        public object Run(string sign,params object[] data)
        {
          return Asm.Invoke("*."+sign,pEngine.Host,data);

        }
        void ExecuteScript(string script)
        {
            var helper = new AsmHelper(CSScript.Load(script, null, true));
            helper.Invoke("*.Execute", this);
        }
      

       

    }
}
